package es

import (
	"context"
	"strings"
)

// 创建仓库
func (e *EsClient) SnapshotCreateRepository(repository string, settings map[string]interface{}) (res interface{}, err error) {
	return e.rawClient.SnapshotCreateRepository(repository).Type("fs").Settings(settings).Do(context.TODO())
}

// 查看仓库
func (e *EsClient) SnapshotGetRepository(repositorys string) (res interface{}, err error) {
	return e.rawClient.SnapshotGetRepository(strings.Split(repositorys, ",")...).Do(context.TODO())
}

// 校验仓库
func (e *EsClient) SnapshotVerifyRepository(repository string) (res interface{}, err error) {
	return e.rawClient.SnapshotVerifyRepository(repository).Do(context.TODO())
}

// 删除仓库
func (e *EsClient) SnapshotDeleteRepository(repositorys string) (res interface{}, err error) {
	return e.rawClient.SnapshotDeleteRepository(strings.Split(repositorys, ",")...).Do(context.TODO())
}

// 创建快照
func (e *EsClient) SnapshotCreate(repository, snapshot string) (res interface{}, err error) {
	return e.rawClient.SnapshotCreate(repository, snapshot).WaitForCompletion(true).Do(context.TODO())
}